// Charge tout les modules comme SDL2


#ifndef INIT_MODULES_H 
#define INIT_MODULES_H

#include <SDL.h>
#include <SDL_mixer.h>
#include <SDL_ttf.h>
#include <SDL_image.h>
#include <GL/gl.h>
#include <GL/glu.h>

int init(){
	
  if(SDL_Init(SDL_INIT_EVERYTHING)==-1){
    
	printf("Impossible d'appeler les modules sdl2 ! SDL_Error: %s\n",SDL_GetError());    
	return 1;
  
  }
  
  SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
  SDL_GL_SetAttribute(SDL_GL_ACCELERATED_VISUAL, 1);
  
  if(TTF_Init()==-1){
  
    printf("Impossible d'appeler sdl2 ttf ! SDL_Error: %s\n",SDL_GetError());
    return 1;
  
  }
  
  if(Mix_OpenAudio(22050, MIX_DEFAULT_FORMAT, 2, 4096)==-1){

    printf("Impossible d'appeler sdl2 mix ! SDL_Error: %s\n",SDL_GetError());
    return 1;
          
  }
  
  Mix_AllocateChannels(6);
  
  if(IMG_Init(IMG_INIT_PNG | IMG_INIT_JPG)==-1){
  
    printf("Impossible d'appeler sdl2 image ! SDL_Error: %s\n",SDL_GetError());
    return 1;
  
  }
  
  return 0;

}

int shutdown(){
	
  SDL_Quit();
  Mix_CloseAudio();
  TTF_Quit();
  IMG_Quit();
  return 0;
	
}

#endif
